package tcm.com.gistone.api.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import tcm.com.gistone.database.config.GetBySqlMapper;

import java.util.List;
import java.util.Map;

/**
 * Created by wangfan on 2017/9/3.
 */
@Service
public class KnowledgeService {

    @Autowired
    private GetBySqlMapper getBySqlMapper;



    public  Map getKnowledgeInfo(long bookId,String word){
        String sql = "select b.book_name,a.* from tb_knowledge a,tb_bookinfo b  where a.book_id =b.book_id and b.status=7 and  a.book_id =" + bookId + " and a.knowledge_name ='" + word + "'";
        List<Map> result = getBySqlMapper.findRecords(sql);
        if(result.size()>0){
            return result.get(0);
        }else {
            return  null;
        }


    }




    }
